package com.ai.entity.security.page;

import com.ai.entity.security.SysPermission;
import com.ai.entity.comm.page.SysBasePage;
import com.alibaba.druid.util.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

@Data
@Accessors(chain = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class SysPermissionPage extends SysBasePage<SysPermission> {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("权限code")
    private String permissionCode;

    @ApiModelProperty("权限名")
    private String permissionName;

    public QueryWrapper<SysPermission> getQuery(QueryWrapper<SysPermission> queryWrapper) {
        return super.getQuery(queryWrapper)
                .like(!StringUtils.isEmpty(permissionCode),"permission_code",permissionCode)
                .like(!(StringUtils.isEmpty(permissionName)),"permission_name",permissionName);
    }
}
